/*
 * @Author: your name
 * @Date: 2021-02-19 16:36:56
 * @LastEditTime: 2021-04-12 22:53:34
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \xgwsp_frontendd:\project\vue3-vite-tsx-master\src\router\index.ts
 */
import { RouteRecordRaw, createRouter, createWebHistory } from 'vue-router';
import { routerHooks } from './permission';
import Main from '../components/layout/LayoutMain';

const routes: RouteRecordRaw[] = [
  {
    path: '/',
    name: 'home',
    component: Main,
    redirect: '/index',
    children: [
      {
        path: 'index',
        name: 'index',
        component: () => import('views/index'),
      },
    ],
  },
  {
    path: '/system',
    name: 'system',
    component: Main,
    redirect: '/system/user',
    meta: {
      title: '系统管理',
      isSidebar: true,
      icon: 'system',
    },
    children: [
      {
        path: '/system/user',
        name: 'system_user',
        component: () => import('views/system/system-user'),
        meta: {
          title: '用户管理',
          isSidebar: true,
          icon: 'user',
        },
      },
      {
        path: '/system/role',
        name: 'system_role',
        component: () => import('views/system/system-role'),
        meta: {
          title: '角色管理',
          isSidebar: true,
          icon: 'role',
        },
      },
    ],
  },
  {
    path: '/garbage',
    name: 'garbage',
    component: Main,
    redirect: '/garbage/calculation',
    meta: {
      title: '垃圾费管理',
      isSidebar: true,
    },
    children: [
      {
        path: '/garbage/list',
        name: 'garbage_list',
        component: () => import('views/garbage/garbage-index'),
        meta: {
          title: '垃圾费管理',
          isSidebar: true,
        },
      },
      {
        path: '/garbage/calculation',
        name: 'garbage_calculation',
        component: () => import('views/garbage/garbage-calculation'),
        meta: {
          title: '垃圾费算法模型',
          isSidebar: true,
        },
      },
      {
        path: '/garbage/edit/:id',
        name: 'garbage_edit',
        component: () => import('views/garbage/garbage-details'),
        meta: {
          title: '垃圾费模型编辑',
          isSidebar: false,
        },
      },
    ],
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('views/login'),
  },
];
const router = createRouter({
  history: createWebHistory(),
  routes,
});
routerHooks(router);
export default router;
